<template>
  <view class="page">
    <!-- 状态栏占位 -->
    <view :style="{ height: statusBarHeight + 'px' }"></view>

    <!-- 导航栏 -->
    <view class="nav-bar">
      <view class="nav-title">我的</view>
    </view>

    <!-- 主内容 -->
    <scroll-view scroll-y class="content">
      <!-- 用户信息卡片 -->
      <view class="user-card">
        <view class="user-card-bg"></view>
        <view class="user-info">
          <view class="user-header">
            <image
              class="user-avatar"
              src="https://images.unsplash.com/photo-1544005313-94ddf0286df2?q=80&w=600&auto=format&fit=crop"
              mode="aspectFill"
            />
            <view class="user-details">
              <text class="user-name">李伟</text>
              <text class="user-hospital">第一人民医院</text>
              <text class="user-position">ICU重症医学科 · 主治医师</text>
            </view>
          </view>

          <!-- 统计数据 -->
          <view class="user-stats">
            <view class="stat-item">
              <text class="stat-value">38.5</text>
              <text class="stat-label">年度学分</text>
            </view>
            <view class="stat-item">
              <text class="stat-value">124</text>
              <text class="stat-label">学习小时</text>
            </view>
            <view class="stat-item">
              <text class="stat-value">18</text>
              <text class="stat-label">证书数量</text>
            </view>
          </view>
        </view>
      </view>

      <!-- 菜单列表 -->
      <view class="menu-list">
        <view class="menu-item" @tap="goToBasicInfo">
          <view class="menu-item-left">
            <text class="fa fa-id-card" style="color: rgb(22 163 74)"></text>
            <text class="menu-text">基本信息</text>
          </view>
          <text class="menu-arrow">›</text>
        </view>

        <view class="menu-item" @tap="goToPersonalProfile">
          <view class="menu-item-left">
            <text class="fa fa-user" style="color: rgb(79 70 229)"></text>
            <text class="menu-text">个人档案</text>
          </view>
          <text class="menu-arrow">›</text>
        </view>

        <view class="menu-item" @tap="goToCertificates">
          <view class="menu-item-left">
            <text class="fa fa-trophy" style="color: rgb(37 99 235)"></text>
            <text class="menu-text">我的证书</text>
          </view>
          <text class="menu-arrow">›</text>
        </view>

        <view class="menu-item" @tap="goToResults">
          <view class="menu-item-left">
            <text class="fa fa-clipboard" style="color: rgb(236 139 45)"></text>
            <text class="menu-text">考试成绩</text>
          </view>
          <text class="menu-arrow">›</text>
        </view>

        <view class="menu-item" @tap="goToLearningRecord">
          <view class="menu-item-left">
            <text class="fa fa-clock-o" style="color: rgb(14 165 233)"></text>
            <text class="menu-text">学习记录</text>
          </view>
          <text class="menu-arrow">›</text>
        </view>

        <view class="menu-item" @tap="goToMessages">
          <view class="menu-item-left">
            <text class="fa fa-bell" style="color: rgb(245 158 11)"></text>
            <text class="menu-text">消息通知</text>
          </view>
          <text class="menu-arrow">›</text>
        </view>

        <view class="menu-item" @tap="goToSettings">
          <view class="menu-item-left">
            <text class="fa fa-cog"></text>
            <text class="menu-text">设置</text>
          </view>
          <text class="menu-arrow">›</text>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 0,
    };
  },
  onLoad() {
    const systemInfo = uni.getSystemInfoSync();
    this.statusBarHeight = systemInfo.statusBarHeight || 0;
  },
  methods: {
    goToHome() {
      uni.switchTab({
        url: "/pages/index/index",
      });
    },
    goToWorkbench() {
      uni.switchTab({
        url: "/pages/workbench/workbench",
      });
    },
    goToBasicInfo() {
      uni.navigateTo({
        url: "/pages/basic-info/basic-info",
      });
    },
    goToPersonalProfile() {
      uni.navigateTo({
        url: "/pages/personal-profile/personal-profile",
      });
    },
    goToCertificates() {
      uni.navigateTo({
        url: "/pages/certificates/certificates",
      });
    },
    goToResults() {
      uni.navigateTo({
        url: "/pages/result/result",
      });
    },
    goToLearningRecord() {
      uni.showToast({
        title: "学习记录功能开发中",
        icon: "none",
      });
    },
    goToMessages() {
      uni.navigateTo({
        url: "/pages/message/message",
      });
    },
    goToSettings() {
      uni.showToast({
        title: "设置功能开发中",
        icon: "none",
      });
    },
  },
};
</script>

<style scoped>
.page {
  min-height: 100vh;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
}

.nav-bar {
  height: 44px;
  background-color: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-title {
  font-size: 17px;
  font-weight: 600;
  color: #000000;
}

.content {
  flex: 1;
  padding-bottom: 60px;
}

/* 用户卡片 */
.user-card {
  margin: 12px 16px 16px;
  border-radius: 16px;
  background: linear-gradient(to right, #6366f1, #3b82f6);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.user-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
}

.user-info {
  position: relative;
  z-index: 1;
}

.user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 24px;
}

.user-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 16px;
  font-weight: 500;
  color: #ffffff;
}

.user-hospital,
.user-position {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

.user-stats {
  display: flex;
  gap: 12px;
}

.stat-item {
  flex: 1;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

/* 菜单列表 */
.menu-list {
  margin: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  background-color: #f9fafb;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-icon {
  font-size: 20px;
}

.menu-text {
  font-size: 14px;
  color: #111827;
}

.menu-arrow {
  font-size: 20px;
  color: #9ca3af;
}
</style>

